<extend name="Public/base" />
<block name="style">
    <style type="text/css">
        .form-item{border-bottom: 1px dashed #ccc;padding-top: 5px;padding-bottom: 5px;}
        .item-label{float: left;width: 130px;text-align: right;padding-right: 20px;color: #999;}
        .controls{float: left;}
    </style>
</block>
<block name="body"><php>    $PROVINCE = C('PROVINCE');</php>
    <div class="main-title cf">
        <h2 style="padding-left: 10px;">{$info.realname} 详细资料</h2>
    </div>
    <!-- 标签页导航 -->
    <div class="tab-wrap">
        <div class="tab-content">
            <ul class="tab-nav nav">
                <li data-tab="tab1" class="current"><a href="javascript:void(0);">个人信息 </a></li>
                <li data-tab="tab2" class=""><a href="javascript:void(0);">职业信息 </a></li>
                <li data-tab="tab3" class=""><a href="javascript:void(0);">社会关系 </a></li>
            </ul>
            <!-- 表单 -->
            <form id="form" method="post" class="form-horizontal doc-modal-form">
                       <!-- 学籍信息  -->
                <div id="tab1" class="tab-pane in tab1">
                   
                    <div class="form-item cf">
                        <label class="item-label">婚姻状态： </label>
                        <div class="controls">
                            <span>
                                <php>
                                    $MEMBER_MARITAL_STATUS = C('MEMBER_MARITAL_STATUS');
                                    echo $MEMBER_MARITAL_STATUS[$info['marital_status']];
                                </php>
                            </span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">居住省份：  </label>
                        <div class="controls">
                            <span> {$PROVINCE[$info[reside_province]]}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">居住区域：  </label>
                        <div class="controls">
                          <span>
                          <php>
                                $data   =   D('Area')->get_addr($info['reside_area']);
                                print_r($data);
                               
                            </php>
                            </span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">详细地址：  </label>
                        <div class="controls">
                            <span>{$info.reside_addr}</span>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">居住时长：  </label>
                        <div class="controls">
                            <span>
                                <php>
                                    $MEMBER_RESIDE_DURATION = C('MEMBER_RESIDE_DURATION');
                                    echo $MEMBER_RESIDE_DURATION[$info['reside_duration']]
                                </php>
                            </span>
                        </div>
                    </div>
                </div>

                    <!-- 学历信息  -->
                       <div id="tab2" class="tab-pane tab2">

                           <div class="form-item cf">
                               <label class="item-label">单位名称：</label>
                               <div class="controls">
                                   <span>{$info.unitname}</span>
                               </div>
                           </div>
                           <div class="form-item cf">
                               <label class="item-label">职业类型：</label>
                               <div class="controls">
                                   <span>
                                       <php>
                                           $MEMBER_CAREER_TYPE = C('MEMBER_CAREER_TYPE');
                                           echo $MEMBER_CAREER_TYPE[$info['career_type']];
                                       </php>
                                   </span>
                               </div>
                           </div>
                           <div class="form-item cf">
                               <label class="item-label">单位省份： </label>
                               <div class="controls">
                                   <span>{$PROVINCE[$info[unit_province]]}</span>
                               </div>
                           </div>
                           <div class="form-item cf">
                               <label class="item-label">单位城市 ：  </label>
                               <div class="controls">
                                   <span><php>
                                       $data   =   D('Area')->get_addr($info['unit_area']);echo ($data);
                                   </php></span>
                               </div>
                           </div>
                           <div class="form-item cf">
                               <label class="item-label">单位地址 ：  </label>
                               <div class="controls">
                                   <span>{$info.unit_addr}</span>
                               </div>
                           </div>
                           <div class="form-item cf">
                               <label class="item-label">单位电话 ：  </label>
                               <div class="controls">
                                   <span>{$info.unit_phone}</span>
                               </div>
                           </div>


                       </div>
                    <div id="tab3" class="tab-pane tab3">
                        <div class="form-item cf">
                            <label class="item-label"><php>
                                $MEMBER_RELATI_ONSHIP = C('MEMBER_RELATI_ONSHIP');
                                $relati = 1;
                                if(!empty($info['relati_onship'])){
                                $relati = $info['relati_onship'];
                                }
                               echo  $MEMBER_RELATI_ONSHIP[$info['relati_onship']];
                            </php>姓名：</label>
                            <div class="controls">
                                <span>{$info.relati_name}</span>
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label"><php>
                               echo  $MEMBER_RELATI_ONSHIP[$info['relati_onship']];
                            </php>号码：</label>
                            <div class="controls">
                                <span>{$info.relati_number}</span>
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label"><php>
                                $MEMBER_SOCIAL_RELATIONS = C('MEMBER_SOCIAL_RELATIONS');
                                $social = 1;
                                if(!empty($info['social_relations'])){
                                $social = $info['social_relations'];
                                }
                                echo $MEMBER_SOCIAL_RELATIONS[$info['social_relations']];
                            </php>姓名：</label>
                            <div class="controls">
                                <span>{$info.social_name}</span>
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label"><php>
                                echo $MEMBER_SOCIAL_RELATIONS[$info['social_relations']];
                            </php>号码：</label>
                            <div class="controls">
                                <span>{$info.social_number}</span>
                            </div>
                        </div>
                    </div>
            </form>
        </div>

        <input type="text" class="number" style="width:200px;height:30px;">
        <input type="hidden" class="uid" value="{$info.uid}">

        <button class="szkzc" style="border:1px solid #E0EEEE;background:#D1EEEE;box-shadow:2px 1px 2px;"> 设置可注册 </button>

    </div>
</block>
<block name="script">
    <script type="text/javascript" src="__STATIC__/jquery.dragsort-0.5.1.min.js"></script>
    <script type="text/javascript" charset="utf-8">
        Think.setValue("extend", {$info.extend|default=0});
        //导航高亮
        highlight_subnav('{:U('User/index')}');


        $(function(){
            showTab();
        })

        $('.szkzc').click(function(){
          var mobile=$('.number').val();
          // var uid=$('.uid').val();
          alert(mobile)
          $.ajax({
            type:'post',
            data:{'mobile':mobile},
            url:"{:U('set_deny')}",
            success:function(m){
              if(m==1){
                  alert('设置成功')
              }else if(m==0){
                alert('设置失败')
              }else{
                alert(m)
              }
            

            }
          })
        })

    </script>

    <script type="text/javascript">
        (function(){
            $('.relati_onship').change(function(){
               var val  = $(this).val();
               var html = $(this).find('.option'+val).text();
                html = '请输入'+html+'的手机号码';
                $('.relati_number').attr('placeholder',html);
            });
            $('.social_relations').change(function(){
                var val  = $(this).val();
                var html = $(this).find('.option'+val).text();
                html = '请输入'+html+'的手机号码';
                $('.social_number').attr('placeholder',html);
            });

            $('.relati_number').change(function(){
                var val  = $(this).val();
                checkMobile(val);
            });
            $('.social_number').change(function(){
                var val  = $(this).val();
                checkMobile(val);
            });
            $('.dwdh').change(function(){
                var val  = $(this).val();
                if(!(/^0\d{10}$/.test(val))){ 
                   alert("单位号码输入有误！"); 
                   return false; 
                }
            });



        })();

        function checkMobile(sMobile){ 
         if(!(/^1[3|4|5|7|8][0-9]\d{8}$/.test(sMobile))){ 
          alert("不是完整的11位手机号或者正确的手机号前3位"); 
          return false; 
         }
        } 
    </script>
    <script >
        var province,Url;
        province = <php>echo json_encode($province)</php>;
        Url      = "{:U('Ajax/getRegion')}";
        Zepto(function($){
            //居住省份选择
            $('.reside_province_select').on('click', function () {
                weui.picker(province, {
                    onChange: function (result) {
                    },
                    onConfirm: function (result) {
                        for (var i=0;i<province.length;i++){
                            if(province[i].value==result){
                                $('.reside_province_text').html(province[i].label);
                                $('.reside_province').val(result);
                            }
                        }
                    }
                });
            });
            //省份未选择时无法选择居住区域
            $('.reside_area_select').on('click', function () {
                var reside_province = $('.reside_province').val();
                if(reside_province=='' || reside_province==0){
                    alert('请选择居住省份');return false;
                }
                AjaxGet(Url,{pid:reside_province},function(data){

                    weui.picker(data, {
                        onChange: function (result) {
                        },
                        onConfirm: function (result) {
                            for (var i=0;i<data.length;i++){
                                if(data[i].value==result){
                                    $('.reside_area_text').html(data[i].label);
                                    $('.reside_area').val(result);
                                }
                            }
                        }
                    });
                });
            });
            //单位省份
            $('.unit_province_select').on('click', function () {
                weui.picker(province, {
                    onChange: function (result) {
                    },
                    onConfirm: function (result) {
                        for (var i=0;i<province.length;i++){
                            if(province[i].value==result){
                                $('.unit_province_text').html(province[i].label);
                                $('.unit_province').val(result);
                            }
                        }
                    }
                });
            });
            //单位区域
            $('.unit_area_select').on('click', function () {
                var unit_province = $('.unit_province').val();
                if(unit_province=='' || unit_province==0){
                    alert('请选择单位省份');return false;
                }
                AjaxGet(Url,{pid:unit_province},function(data){
                    weui.picker(data, {
                        onChange: function (result) {
                        },
                        onConfirm: function (result) {
                            for (var i=0;i<data.length;i++){
                                if(data[i].value==result){
                                    $('.unit_area_text').html(data[i].label);
                                    $('.unit_area').val(result);
                                }
                            }
                        }
                    });
                });
            });

           // 提交
            $('.login-btn').click(function(){
                var data =  $('form').serializeArray();
                $.ajax({
                    type:'post',
                    url:"{:U('Member/userinfo')}",
                    data:data,
                    // dataType:'json',
                    beforeSend:function(XMLHttpRequest){
                        loading('正在提交中');
                        //ShowLoading();正在提交中
                    },
                    success:function(m){
                        alert(m)
                        setTimeout(function(){
                            location.href="{:U('Index/index')}"
                        },1500);
                        
                        // alert(m['info']);
                        // location.href=m['url']
                    },
                    complete:function(XMLHttpRequest,textStatus){
                       noloading();
                    },
                   
            });
           
            }) ;
        });

    

    </script>

</block>

